home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / DoubleDoorPivotSwitchPivot.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.4 KB  |  69 lines

  1. public class DoubleDoorPivotSwitchPivot extends Codex {
  2.    private float _duration = 3.0F;
  3.    private CodexThing _switch = new CodexThing(((Codex)this).GetClassThing());
  4.    private CodexThing _door1;
  5.    private CodexThing _door2;
  6.    private int _frameNum = 1;
  7.    private boolean bOpen;
  8.    private boolean bActive;
  9.    public static String[] _params = new String[]{"Duration;3.0", "First half door", "Second half door"};
  10.  
  11.    public void clicked(int guid, int clickerGuid, int captureId) {
  12.       if (guid != this._switch.GetGUID()) {
  13.          new CodexSound("locked_large_02.WAV", 300.0F, 600.0F, 100, 0, 0, clickerGuid);
  14.          CodexConsole.PrintNLS(clickerGuid, 0, "GEN_OPENELSEWHERE");
  15.       } else {
  16.          this.bActive = true;
  17.          if (!this.bOpen) {
  18.             this._switch.RotatePivot(this._frameNum, this._duration);
  19.             this._door1.RotatePivot(this._frameNum, this._duration);
  20.             this._door2.RotatePivot(this._frameNum, this._duration);
  21.             this.bOpen = true;
  22.          } else {
  23.             this._switch.RotatePivot(this._frameNum, -this._duration);
  24.             this._door1.RotatePivot(this._frameNum, -this._duration);
  25.             this._door2.RotatePivot(this._frameNum, -this._duration);
  26.             this.bOpen = false;
  27.          }
  28.  
  29.       }
  30.    }
  31.  
  32.    public void beginscene(int clientGuid, int captureID) {
  33.       this._door1.SetThingFlags(8192);
  34.       this._door2.SetThingFlags(8192);
  35.    }
  36.  
  37.    public void arrived(int thingGuid, int frameNum, int captureId) {
  38.       this.bActive = false;
  39.    }
  40.  
  41.    public void restore(int flags) {
  42.       this.bOpen = CodexSequence.RestoreBoolean();
  43.    }
  44.  
  45.    public void save(int flags) {
  46.       CodexSequence.SaveBoolean(this.bOpen);
  47.    }
  48.  
  49.    public DoubleDoorPivotSwitchPivot(float duration, CodexThing door1, CodexThing door2) {
  50.       this._duration = duration;
  51.       this._door1 = new CodexThing(((Codex)door1).GetGUID());
  52.       this._door2 = new CodexThing(((Codex)door2).GetGUID());
  53.       ((Codex)this).CaptureThing(this._door1.GetGUID());
  54.       ((Codex)this).CaptureThing(this._door2.GetGUID());
  55.       if (this._door1.GetDescriptionID().equalsIgnoreCase("PROP")) {
  56.          this._door1.SetDescriptionID("GEN_DOOR");
  57.       }
  58.  
  59.       if (this._door2.GetDescriptionID().equalsIgnoreCase("PROP")) {
  60.          this._door2.SetDescriptionID("GEN_DOOR");
  61.       }
  62.  
  63.       if (this._switch.GetDescriptionID().equalsIgnoreCase("PROP")) {
  64.          this._switch.SetDescriptionID("GEN_SWITCH");
  65.       }
  66.  
  67.    }
  68. }
  69.